package com.zhanghs.contentcenter.config;

import com.zhanghs.contentcenter.util.TraceIdContext;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.context.annotation.Configuration;

/**
 * @Author zhanghongshan
 * @date 2021/10/2 6:05 下午
 */
@Configuration
public class FeignConfig implements RequestInterceptor {
    /**
     * feign请求设置 traceId
     * @param requestTemplate
     */
    @Override
    public void apply(RequestTemplate requestTemplate) {
        requestTemplate.header(TraceIdContext.TRACE_ID_KEY, TraceIdContext.getTraceId());
    }
}
